<?php

class ErrorController extends Controller{
	
	public function init() {
        parent::init();
        Yaf\Dispatcher::getInstance()->disableView();
    }
	
	public function errorAction($exception){
		switch ($exception->getCode()) {  
            case Yaf_ERR_NOTFOUND_MODULE:  
            case Yaf_ERR_NOTFOUND_CONTROLLER:  
            case Yaf_ERR_NOTFOUND_ACTION:  
            case Yaf_ERR_NOTFOUND_VIEW:  
                $this->show('Error/404.php');
                break;  
            default :
                if(!DEBUG){
                    $this->show('Error/404.php');
                    break;
                }
                // print_r($exception);exit;
                echo '错误号：'.$exception->getCode().'<br>';  
	            echo '错误提示：'.$exception->getMessage().'<br>';  
	            echo '错误行：'.$exception->getLine().'<br>';
                echo '错误文件：'.str_replace(APP_PATH.'\\', '', $exception->getFile()).'<br>';
                echo "TRACE：<br>";
                foreach ($exception->getTrace() as $key => $value) {
                    if($key<=7){
                        echo $key."&nbsp;".$value['file']."(".$value['line'].")：".$value['function'] ."<br>";
                    }
                    
                }
                break;  
        }
	}
}